package com.netnovelstore.service;

import com.netnovelstore.pojo.Book;
import com.netnovelstore.pojo.Exception.FailureBehaviorException;
import com.netnovelstore.pojo.Exception.NotDataException;
import com.netnovelstore.pojo.Result;
import com.netnovelstore.viewObject.BookListResult;
import com.netnovelstore.viewObject.ReadBookResult;
import com.netnovelstore.viewObject.UploadBookFileResult;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
public interface BookService {

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 获取所有书的数量
     * @Date 10:11 2022/10/3
     * @Param null
     **/
    default Result<Integer> countBookList() {
        return null;
    }


    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 分页获取所有书
     * @Date 10:09 2022/10/3
     * @Param [pageSize, currentPage]
     **/
    default Result<List<Book>> getBookList(Integer currentPage, Integer pageSize) throws Exception {
        return null;
    }


    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 按照书名和章节获取正文
     * @Date 10:11 2022/9/20
     * @Param [bookName, number]
     **/
    default Result<ReadBookResult> readBook(Integer bookNumber, Integer number) {
        return null;
    }

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 按照书名返回指定书的章节数量
     * @Date 10:13 2022/9/20
     * @Param [bookName]
     **/
    default Result<Integer> getChapterTotal(Integer bookNumber) {
        return null;
    }

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 按照 关键字 分页搜索所有书
     * @Date 10:14 2022/9/22
     * @Param [keyword, pageStart, pageSize]
     **/
    default Result<List<Book>> searchBook(String keyword, Integer currentPage, Integer pageSize) {
        return null;
    }

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 按照 关键字 获取所有书的 总数
     * @Date 10:14 2022/9/22
     * @Param [keyword]
     **/
    default Result<Integer> getCountBySearchBook(String keyword) throws Exception {
        return null;
    }


    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 按照 类型 分页搜索所有书
     * @Date 10:14 2022/9/22
     * @Param [currentPage, pageSize, type]
     **/
    default Result<List<Book>> getBookListByType(Integer currentPage, Integer pageSize, String type) throws NotDataException {
        return null;
    }

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 按照 类型 获取所有书的 总数
     * @Date 10:14 2022/9/22
     * @Param [type]
     **/
    default Result<Integer> getCountBySearchBookByType(String type) throws Exception {
        return null;
    }


    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 按照 免费类型 分页搜索所有书
     * @Date 10:14 2022/9/22
     * @Param [currentPage, pageSize]
     **/

    Result<BookListResult> getBookListByFree(Integer currentPage, Integer pageSize) throws NotDataException;

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 按照 完本类型 分页搜索所有书
     * @Date 10:14 2022/9/22
     * @Param [currentPage, pageSize]
     **/
    Result<BookListResult> getBookListByFull(Integer currentPage, Integer pageSize) throws NotDataException;

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 按照 新书排行榜 分页搜索所有书
     * @Date 10:14 2022/9/22
     * @Param [currentPage, pageSize]
     **/
    Result<List<Book>> getBookListByNew(Integer currentPage, Integer pageSize) throws NotDataException;

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 按照 热度排行榜 分页搜索所有书
     * @Date 10:14 2022/9/22
     * @Param [currentPage, pageSize]
     **/
    Result<List<Book>> getBookListByHot(Integer currentPage, Integer pageSize) throws NotDataException;

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 添加书籍
     * @Date 10:49 2022/10/4
     * @Param [book]
     **/
    @Transactional(rollbackFor = Exception.class)
    Result<Boolean> addBook(Book book) throws Exception;

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 依 书籍编号 编辑 书籍
     * @Date 10:50 2022/10/4
     * @Param [book]
     **/
    @Transactional(rollbackFor = Exception.class)
    Result<Boolean> setBookByNumber(Book book);

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 依 书籍编号 删除书籍
     * @Date 10:53 2022/10/4
     * @Param [numberList]
     **/
    @Transactional(rollbackFor = Exception.class)
    Result<Boolean> delBooksByNumberList(List<Integer> numberList) throws FailureBehaviorException;

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 依 书籍编号更新 访问人数
     * @Date 16:03 2022/10/4
     * @Param [bookNumber]
     **/
    @Transactional(rollbackFor = Exception.class)
    Result<Boolean> setQuantityByNumber(Integer quantity, Integer bookNumber) throws FailureBehaviorException;

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 上传书籍
     * @Date 21:59 2022/10/4
     * @Param [file]
     **/
    @Transactional(rollbackFor = Exception.class)
    Result<UploadBookFileResult> uploadBookFile(MultipartFile file) throws IOException;

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 上传书籍封面
     * @Date 10:46 2022/10/6
     * @Param [file]
     **/
    @Transactional(rollbackFor = Exception.class)
    Result<String> uploadBookCover(MultipartFile file) throws IOException;


}
